SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		?Autor
-- Create date: ?Fecha
-- Description:	?Descripcion
-- =============================================
CREATE TRIGGER [?Esquema].[Insertar?NomTabla]
ON [?Esquema].[?NomTabla]
AFTER INSERT
AS 
BEGIN
	SET NOCOUNT ON;

	DECLARE curIns CURSOR LOCAL FOR 
					SELECT ?CamposBaseDatos
					FROM   inserted;
										
	DECLARE ?Declare
	
    DECLARE @vAccion AS VARCHAR(4000)

    OPEN curIns;
    
	FETCH curIns INTO ?Variables
    
  WHILE @@FETCH_STATUS=0
  BEGIN
	SET @vAccion='INSERT. '+?Accion
	
	INSERT obd.LOGMOVIMIENTOS (tabla, idReg, fecha, 
							   user_Id, accion)
    VALUES ('?NomTabla', @vIdReg, GETDATE(), 
			@vUser_Id, @vAccion)
  END
    
END
GO